#if !defined(AFX_BASESPRITE_H__3ED8098D_78A4_4843_A730_A7996CC12D57__INCLUDED_)
#define AFX_BASESPRITE_H__3ED8098D_78A4_4843_A730_A7996CC12D57__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class BaseLogicSprite;
class BaseDispSprite  
{
public:
	BaseDispSprite(int nLayer,bool bDrawOnView=false,bool bCycle=false);
	virtual ~BaseDispSprite();
	static bool Initialize(LPDIRECT3DDEVICE9 pd3dDevice );
	static void Uninitialize();
	virtual bool Draw( DWORD dwCurrentTime )=0;
	static HRESULT Begin(DWORD flags){return m_pD3DSprite->Begin(flags);}
	static HRESULT End(){return m_pD3DSprite->End();}
	static void DrawText(LPCTSTR text, LPRECT rc, DWORD Format,D3DCOLOR Color)
	{
		m_pStatsFont->DrawText(m_pD3DSprite,text,-1, rc, Format, Color);
	}
	int GetLayer()const{return m_nLayer;}
	void SetCenter(D3DXVECTOR2 vCenter){m_vCenter=vCenter;}
	void SetLgSprite(BaseLogicSprite *pLgSprite ){m_pLgSprite=pLgSprite;}
	void SetString(CString s){ m_csStr=s;}
	static void SetMapWidth(int n){m_nMapWidth=n;}
	void SetDrawOnView(bool bDrawOnView){m_bDrawOnView=bDrawOnView;}
#ifdef TEST_COLLAPSE
	static void DrawLine(D3DXVECTOR2 p1,D3DXVECTOR2 p2);
#endif
    D3DXVECTOR2 m_vPosition;
		CString m_csStr;
protected:
	bool UpdatePosByLgSprite();

	static LPD3DXSPRITE m_pD3DSprite;

	int m_nLayer;
	D3DXVECTOR2 m_vCenter;   

	BaseLogicSprite *m_pLgSprite;
	bool m_bDrawOnView;
	bool m_bCycle;
	static int m_nMapWidth;
	static LPD3DXFONT m_pStatsFont;
	//FOR TEST
	static LPD3DXLINE m_pLine;

private:
	BaseDispSprite(const BaseDispSprite& st);
	const BaseDispSprite& operator=(const BaseDispSprite& st);
};

#endif // !defined(AFX_BASESPRITE_H__3ED8098D_78A4_4843_A730_A7996CC12D57__INCLUDED_)
